<script type="text/javascript">
	

let stack1 = [],
    stack2 = [];
function push(node)
{
    stack1.push(node);
}
function pop()
{
    // 将stack1中的数据push进stack2中
    for(let len = stack1.length-1, i = len; i >= 0; i--) {
        if(i==0) continue
        stack2.push(stack1.pop())
    }
    
    // 还原数据
    let res = stack1[0]
    for(let i = 0; i < stack2.length; i++) {
        stack1[i] = stack2.pop()
    }
    return res
}
push(1)
push(2)
push(3)
console.log(pop())
console.log(pop())
push(4)
console.log(pop())
push(5)
console.log(pop())
console.log(pop())



</script>